package de.preamp.clients.java.lib.ui;

import java.io.IOException;

import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import de.preamp.clients.java.lib.AbstractLibrary;
import de.preamp.clients.java.lib.RootLibrary;
import de.preamp.clients.java.lib.SearchLibrary;
import de.preamp.clients.java.playlist.PlaylistManager;

/**
 * @author André Stannek
 * @since 2011-06-11
 * @version 2011-06-11
 */
@Component("libraryBean")
public class LibraryBean
{
    /**
     * 
     */
    @Autowired(required = true)
    private RootLibrary rootLibrary;

    /**
     * 
     */
    @Autowired(required = true)
    private PlaylistManager playlistManager;

    /**
     * 
     */
    @Autowired(required = true)
    private SearchLibrary searchLibrary;

    /**
     * @return the rootLibrary
     */
    public final AbstractLibrary getRootLibrary()
    {
	return rootLibrary;
    }

    /**
     * @return the playlistManager
     */
    public final PlaylistManager getPlaylistManager()
    {
	return playlistManager;
    }

    /**
     * @param search
     * @return searchLibrary
     * @throws IOException
     * @throws JSONException
     */
    public final AbstractLibrary getSearchLibrary(final String search)
	    throws JSONException, IOException
    {
	searchLibrary.search(search);
	return searchLibrary;
    }
}
